<?php
include '../admin_head.php';


$id = $_GET['id'];
$name = $_GET['name'];

//查询数据
$sql = "select id,name from ".PRE."image where goods_id='{$id}' order by id";
$result = mysql_query($sql);
while($goods = mysql_fetch_assoc($result)){
	$goodslist[] = $goods;
}


?>

	<div class="admin_main_nav">商品管理&gt;&gt;编辑商品&gt;&gt;详情图片</div>
	<div id="goods_index" class="admin_main_index">
		<div class="width">
			<div class="user_index_title"></div>
			<div>
				<table width="800" align="center">
					<tr>
						<th>商品名</th>
						<th>详情描述图片</th>
						<th width="100">操作</th>
					</tr>
					<?php if(!empty($goodslist)):?>
					<?php foreach($goodslist as $tr):?>
					<tr>
						<td><?php echo $name ?></td>
						<td><img src="<?php echo '../../upload/'.$tr['name'] ?>" height="50"/></td>
						<td>
							<div class="action">
								<div class="fl"><a class="del" href="action.php?a=delimg&id=<?php echo $tr['id'] ?>&name=<?php echo $tr['name']?>"><div class="icon fl del_i"></div><div class="fl">删除</div></a></div>
							</div>
						</td>
					</tr>
					<?php endforeach;?>
					<?php else:?>
						<tr>
							<td colspan="3">没有找到任何记录</td>
						</tr>
					<?php endif;?>
				</table>
			</div>
			<div class="add_image">
				<table width="800">
					<div class="user_index_title">
						<div class="title">添加详情图片</div>
					</div>
					<form action="action.php?a=addimg&id=<?php echo $id?>" method="post" enctype="multipart/form-data">
						<tr>
							<th>商品图片：</th>
							<td><input type="file" name="pic[]" /></td>
							<td><input type="file" name="pic[]" /></td>
							<td class="submit"><input type="submit" value="添加图片" /></td>
						</tr>
					</form>
				</table>
			</div>
		</div>
	</div>

	
<?php include '../admin_footer.php'; ?>


